package com.company;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class TriMat {

    private int row;
    private int col;
    private List<Tirple> list = new ArrayList<>();
    private int count;

    public TriMat() {
    }

    public void createTirple(int[][] arr) {


        row = arr.length;
        col = arr[0].length;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                if (arr[i][j] != 0) {
                    list.add(new Tirple(i,j,arr[i][j]));
                }

            }
        }
    }

    public int getCount() {
        return count;
    }

    public int getRow() {
        return row;
    }

    public void setRow(int row) {
        this.row = row;
    }

    public int getCol() {
        return col;
    }

    public void setCol(int col) {
        this.col = col;
    }

    public List<Tirple> getList() {
        return list;
    }

    public void setList(List<Tirple> list) {
        this.list = list;
    }
    public int[][] decompression(){
        int[][] temp = new int[row][col];

        Iterator<Tirple> iterator = list.iterator();

        while (iterator.hasNext()){
            Tirple tirple = iterator.next();
            temp[tirple.getRow()][tirple.getCol()]=tirple.getValue();
        }



       return temp;
    }
}
